package com.powernode.teatraceability.controller.login;


import com.powernode.teatraceability.pojo.login.User;
import com.powernode.teatraceability.utils.JsonData;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttribute;

/**
 * ClassName: UserController
 * Description:
 *
 * @Author: jdz
 * @Create: 2023/4/21 - 23:20
 */
@RestController
@RequestMapping("/api/user")
public class UserController {
    /**
     * 从 session 中获取名为 "user" 的属性，并将其绑定到 User 类型的参数上
     * @param user
     * @return
     */
    @GetMapping("/me")
    public JsonData<User> me(@SessionAttribute("user") User user) {
        return JsonData.success(user);
    }
}
